Add a macro for `return Err(human(format!(...)))`
authorAlex Crichton <alex@alexcrichton.com>
Fri, 20 Nov 2015 18:46:43 +0000 (10:46 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 20 Nov 2015 18:57:03 +0000 (10:57 -0800)
commit7ab18e3aeb6f6416db2ca36e2fa2a007ea07dbfe
tree7c157ee7a66a0580ad265bd4c515b4ee43810c4a
parent38ea36b143c1193dadb95e3a58ecfae36ca1e7bf
Add a macro for `return Err(human(format!(...)))`

This pattern showed up quite a few locations throughout the codebase but it
ended up meaning that there were some massive levels of indentation when you
actually get to the formatting string. This commit adds a new `bail!` macro
which shortens this idiom to help get the indentation under control throughout
the codebase.
28 files changed:
src/cargo/core/package_id_spec.rs
src/cargo/core/resolver/mod.rs
src/cargo/core/shell.rs
src/cargo/core/summary.rs
src/cargo/lib.rs
src/cargo/ops/cargo_clean.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_doc.rs
src/cargo/ops/cargo_generate_lockfile.rs
src/cargo/ops/cargo_install.rs
src/cargo/ops/cargo_new.rs
src/cargo/ops/cargo_package.rs
src/cargo/ops/cargo_pkgid.rs
src/cargo/ops/cargo_run.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/links.rs
src/cargo/ops/registry.rs
src/cargo/sources/registry.rs
src/cargo/util/config.rs
src/cargo/util/important_paths.rs
src/cargo/util/toml.rs
tests/support/mod.rs
tests/test_cargo_compile.rs
tests/test_cargo_doc.rs
tests/test_cargo_new.rs
tests/test_cargo_registry.rs
tests/test_cargo_rustdoc.rs